var Util = function(){
	this.request_url = "http://open.fologde.com/woocms_tp5_wechat/public/index.php/wzq"
	/**
	 * 获取房间列表
	 */
	var get_room_list = function(callback){
		$.get(this.request_url+"/index/get_room_list", {}, function(res){
			res = JSON.parse(res)
			typeof callback == "function" && callback(res)
		})
	}
	Util.prototype.get_room_list = get_room_list;
	
	/**
	 * todo 获取随机数
	 * @param {Object} min
	 * @param {Object} max
	 */
	Util.prototype.getRandomInt = function(min, max){
		return (Min + Math.round((Math.random()) * (Max - Min)))
	}
	/**
	 * todo 获取房间详情
	 */
	Util.prototype.get_room_detail = function(room_id, callback){
		$.get(this.request_url+"/index/get_room_detail", {room_id:room_id}, function(res){
			typeof callback == "function" && callback(JSON.parse(res))
		})
	}
	
	// 操作 localStorage
	var LS = {
		setLS : function(key, value){
			localStorage.setItem(key,value)
		},
		getLS : function(key){
			return localStorage.getItem(key)
		},
		delLS : function(key){
			localStorage.removeItem(key)
		},
		delAllLS : function(){
			localStorage.clear()
		},
	}
	Util.prototype.LS = LS;
	
	// 获取get参数
	var GetQueryString = function(name){
	     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	     var r = window.location.search.substr(1).match(reg);
	     if(r!=null)return  unescape(r[2]); return null;
	}
	Util.prototype.getQueryString = GetQueryString;
	
}